package com.munisense.webservices.javaclient;

/**
 * MuniFilter
 * 
 * Filters can be used to limit the amount of information that a getList request
 * returns.
 * 
 */
public class MuniFilter {

	private final String field;
	private final Operator operator;
	private final String value;

	public enum Operator {
		EQUALS("eq");

		private String code;

		private Operator(String c) {
			code = c;
		}

		public String getCode() {
			return code;
		}
	}

	public MuniFilter(String field, Operator operator, String value) {
		this.field = field;
		this.operator = operator;
		this.value = value;
	}

	public String getField() {
		return field;
	}

	public Operator getOperator() {
		return operator;
	}

	public String getValue() {
		return value;
	}

	/**
	 * Converts the object to a String in a manner that the REST service
	 * can parse it directly.
	 */
	public String toString() {
		return field + " " + operator + " " + value;
	}
}
